package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.IMoreBindSocialAccountModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;

/**
 * @author Kay
 * @ClassName MoreBindSocialAccountModel
 * @Description
 * @date 2016-10-19
 * @history 2016-10-19 author: description:
 */

public class MoreBindSocialAccountModel extends BaseModel implements IMoreBindSocialAccountModel, HttpWebServiceCallBack {
    public MoreBindSocialAccountModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    @Override
    public void doGetUserOuterAccountList() {
        HashMap<String, String> params = new HashMap<>();
        HttpWebService.getDataFromServer(NetConstant.GETUSEROUTERACCOUNTLIST, params, true, this);
    }

    @Override
    public void doUserOuterSysUnBind(String apptype, String uid) {
        HashMap<String, String> params = new HashMap<>();
        params.put("apptype",apptype);
        params.put("uid",uid);
        HttpWebService.getDataFromServer(NetConstant.USEROUTERSYSUNBIND, params, true, this);
    }

    @Override
    public void doUserBindOuterAccount(String uid, String nickname, String avatar, String apptype) {
        HashMap<String, String> params = new HashMap<>();
        params.put("uid",uid);
        params.put("nickname",nickname);
        params.put("avatar",avatar);
        params.put("apptype",apptype);
        HttpWebService.getDataFromServer(NetConstant.USERBINDOUTERACCOUNT, params, true, this);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if (getBasePresenter() != null) {
            getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
        }
    }
}
